﻿
using MemberPoint.Entity.ViewModel;
using MMPS.Business;
using MMPS.Common;
using MMPS.Entity.POCOMdel;
using MMPS.Entity.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MemberPoint.Business
{
   public class CountCenterService : BaseService<MemCards>
    {
        public OperateResult getQ(string careId)
        {
          
            //判断输入的信息是否为空
            if (!string.IsNullOrWhiteSpace(careId))
            {
              var mod = Find(m => m.MC_CardID == careId || m.MC_Mobile == careId);
                //判断mod是否有数据
                if (mod!=null)
                {
                    //把ef自动生成的model转化成viewmodel
                    ConsumeOrdersViewModel viewModel = new ConsumeOrdersViewModel();
                    viewModel.CL_LevelName = mod.CardLevels.CL_LevelName;
                    viewModel.MC_Name = mod.MC_Name;
                    viewModel.MC_Point =(int) mod.MC_Point;
                    viewModel.MC_TotalMoney =(int) mod.MC_TotalMoney;
                    viewModel.CL_Percent =(double) mod.CardLevels.CL_Percent;
                    viewModel.Time = DateTime.Now;
                    return new OperateResult(ResultStatus.Success, "", viewModel);
                }
                else
                {
                    return new OperateResult(ResultStatus.Error, "信息不存在");
                }
            }
            else
            {
                return new OperateResult(ResultStatus.Error, "卡号或密码不能为空");
            }
        }

      
    }
}
